<template>
    <div id='teml'>
        <div class='c_title'>
            <h4>{{list.title}}</h4>
            <span>{{list.add_time | datefmt('YYYY-MM-DD')}}  &nbsp  &nbsp &nbsp {{list.click}}次浏览</span>
        </div>
        <p v-html='list.content' class="mess"></p>
        <comment></comment>
    </div>
</template>

<script>
import commot from '../../kikt/comment.js'
import comment from '../subcomment/comment.vue'
import { Toast } from 'mint-ui';
    export default {
        data(){
           return {
                list:{},
                id:0
           }
        },
        created(){
           
            this.id = this.$route.params.id;
            this.getnewsinfo()
        },
        methods:{
            getnewsinfo: function(){
               
                var url = commot.apidomain + '/api/getnew/'+this.id ;
                this.$http.get(url).then(function(response){
                    var data = response.body;
                    if(data.status != 0){
                        Toast(data.message);
                        return;
                    }
                    this.list = data.message[0];
                })
            }
        },
        components:{ //子组件
            comment //注册评论组件
        }
    }
</script>

<style scoped>
    .c_title {
        padding:5px;
    }
    .c_title h4 {
        text-align :center;
        color:#ff0080;
    }
    .c_title span {
        display:block;
        color:black;
        opacity:0.5;
        font-size:14px;
        text-align :center;
    }
    .mess {
        padding: 0 5px;
    }
</style>